class CommonResult:
    """通用结果集"""

    def __init__(self, data=None, code=0, msg='成功') -> None:
        self.code = code
        self.msg = msg
        self.data = data

    def keys(self):
        return ['code', 'msg', 'data']

    def __getitem__(self, item):
        return getattr(self, item)

    # flask-json需要
    def __json__(self):
        return dict(self)
